package com.example.xianji.adapter;

import java.util.ArrayList;

import com.example.xianji.R;
import com.example.xianji.bean.YiJi_Class;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

public class FuWu_FenLei_Adapter extends BaseAdapter {
	/************************需求大厅：需求分类 ，选型大厅中一级分类**********************************/
private Context mContext;
private ArrayList<YiJi_Class> fuwu_list;

private int select_postion=-1;


	public FuWu_FenLei_Adapter(Context mContext, ArrayList<YiJi_Class> fuwu_list) {
	super();
	this.mContext = mContext;
	this.fuwu_list = fuwu_list;
}

	@Override
	public int getCount() {
		return fuwu_list.size();
	}

	@Override
	public Object getItem(int arg0) {
		return arg0;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Holder holder;
		if(convertView==null){
			holder=new Holder();
			/*************************服务大厅分类列表   和   需求大厅，选型大厅分类列表公用********************************************/
			convertView=View.inflate(mContext, R.layout.place_listview_item, null);
			holder.linear_layout=(LinearLayout) convertView.findViewById(R.id.linear_layout);
			
			holder.place_text=(TextView) convertView.findViewById(R.id.place_text);
			
			convertView.setTag(holder);
		}
		holder=(Holder) convertView.getTag();
		if(select_postion==position){
			
			holder.linear_layout.setBackgroundColor(mContext.getResources().getColor(R.color.grayF2));
			
		}else{
			
			holder.linear_layout.setBackgroundColor(mContext.getResources().getColor(R.color.white));	
		}
		holder.place_text.setText(fuwu_list.get(position).getName());
		
		return convertView;
	}
class Holder{
	TextView place_text;
	LinearLayout linear_layout;
}
	
	public void setPosition(int position){
		
		select_postion=position;
	}
}
